namespace NHibernateLab.DAL
{
  using NHibernate;
  using Utils;

  /// <summary>
  /// The data layer manager.
  /// </summary>
  public class DataManager
  {
    /// <summary>
    /// Updates the specified object instance.
    /// </summary>
    /// <typeparam name="T">The entity name.</typeparam>
    /// <param name="objectInstance">The object instance.</param>
    public static void Update<T>(T objectInstance)
    {
      using (ISession session = NHibernateHelper.OpenSession())
      {
        using (ITransaction transaction = session.BeginTransaction())
        {
          session.Save(objectInstance);
          transaction.Commit();
        }
      }
    }
  }
}